<?php
namespace Api\Rest;
use Api\Application;
use Api\Http\Response;

/**
 * Class Resource
 * @package Api\Rest
 * @author Steffen Brem <steffenbrem@gmail.com>
 */
class Resource
{
    /**
     * @var \Api\Http\Request
     */
    protected $request;

    /**
     * @var Application
     */
    protected $application;


    /**
     * @var string
     */
    protected  $rootElement = 'results';

    public function getXmlTemplate() {}
    public function getXmlSchema() {}

    /**
     * @param Application $application
     */
    public function __construct(Application $application)
    {
        $this->application = $application;
        $this->request = $application->bootstrap->getRequest();
    }

    /**
     * @return string
     */
    public function getRootElement()
    {
        return $this->rootElement;
    }

    /**
     * Shortcut
     *
     * @param $index
     * @return mixed
     */
    public function param($name)
    {
        return $this->request->getParam($name);
    }

    /**
     * Retrieve a resource
     *
     * @return Response
     */
    public function __read()
    {
        //return new Response(Response::OK);
    }

    /**
     * Create new resource
     */
    public function __create()
    {

    }

    /**
     * Update resource
     */
    public function __update()
    {

    }

    /**
     * Delete a resource
     */
    public function __delete()
    {

    }

    /**
     * Show resource options
     */
    public function __options()
    {

    }
}